﻿<Window x:Class="ComplexAlloysVisualisation.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:local="clr-namespace:ComplexAlloysVisualisation"
        xmlns:zoom="clr-namespace:WPFExtensions.Controls;assembly=WPFExtensions"
        Title="Complex Alloys Visualisation" Height="700" Width="900" MinHeight="400" MinWidth="400"
        Loaded="Window_Loaded"  KeyDown="Window_KeyDown" KeyUp="Window_KeyUp"  >
    <Window.Resources>

        <Storyboard  x:Key="mainInAnimation">
            <DoubleAnimation Storyboard.TargetName="panelTrans"
                                    Storyboard.TargetProperty="X"
                                    BeginTime="0:0:0.2"
                                    Duration="0:0:0.3" To="0" >
                <DoubleAnimation.EasingFunction>
                    <ExponentialEase  EasingMode="EaseOut"  />
                </DoubleAnimation.EasingFunction>
            </DoubleAnimation>
            <DoubleAnimation Storyboard.TargetName="leftPanel" BeginTime="0:0:0.2" Storyboard.TargetProperty="Opacity" Duration="0:0:1" To="1">
                <DoubleAnimation.EasingFunction>
                    <QuadraticEase EasingMode="EaseOut"  />
                </DoubleAnimation.EasingFunction>
            </DoubleAnimation>
        </Storyboard>

        <Storyboard  x:Key="maskIn">
            <DoubleAnimation Storyboard.TargetName="checkBoxPanel" Storyboard.TargetProperty="Opacity" Duration="0:0:0.3" To="1">
                <DoubleAnimation.EasingFunction>
                    <QuadraticEase EasingMode="EaseOut"  />
                </DoubleAnimation.EasingFunction>
            </DoubleAnimation>
        </Storyboard>

        <Storyboard  x:Key="maskOut">
            <DoubleAnimation Storyboard.TargetName="checkBoxPanel" Storyboard.TargetProperty="Opacity" Duration="0:0:0.3" To="0">
                <DoubleAnimation.EasingFunction>
                    <QuadraticEase EasingMode="EaseOut" />
                </DoubleAnimation.EasingFunction>
            </DoubleAnimation>
        </Storyboard>

    </Window.Resources>
    <Window.Background>
        <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
            <LinearGradientBrush.GradientStops>
                <GradientStop Color="#FF242424" Offset="0"/>
                <GradientStop Color="Gray" Offset="1"/>
            </LinearGradientBrush.GradientStops>
        </LinearGradientBrush>
    </Window.Background>

    <Grid Name="mainGrid">
        <zoom:ZoomControl x:Name="zoomControl"  ZoomDeltaMultiplier="0" ModifierMode="None" Background="Transparent" Margin="0,0,-2,0">
            <Grid x:Name="viewPortGrid" Height="700" Width="800">
                <Viewport3D x:Name="viewPort" Height="30" Width="30" Grid.Column="0" Grid.Row="0" ClipToBounds="False" >
                    <Viewport3D.Camera>
                        <OrthographicCamera  x:Name="camera" Position="0,0,-40"  LookDirection="0,0,40"  />
                    </Viewport3D.Camera>
                    <Viewport3D.Children>
                        <ModelVisual3D>
                            <ModelVisual3D.Content>
                                <DirectionalLight Color="White" Direction="0,0,1" />
                            </ModelVisual3D.Content>
                        </ModelVisual3D>
                        <ModelVisual3D x:Name="visualModel">
                            <ModelVisual3D.Transform>
                                <Transform3DGroup></Transform3DGroup>
                            </ModelVisual3D.Transform>
                        </ModelVisual3D>
                    </Viewport3D.Children>
                </Viewport3D>

            </Grid>
        </zoom:ZoomControl>
        <!--  <Grid VerticalAlignment="Center" x:Name="processingGrid" Height="200" Width="200" Visibility="Collapsed"> -->
        <Label VerticalAlignment="Center" HorizontalAlignment="Center" Name="processingLabel" FontSize="40" Visibility="Collapsed">
            Processing
        </Label>
        <!--</Grid>-->
        <StackPanel Name="leftPanel"  Width="100" Margin="5,0,0,5" Opacity="0.0" Orientation="Vertical" HorizontalAlignment="Left" VerticalAlignment="Bottom">
            <StackPanel.RenderTransform>
                <TranslateTransform x:Name="panelTrans" X="-10"></TranslateTransform>
            </StackPanel.RenderTransform>
            <StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
                <Label Content="File: " MinHeight="24" HorizontalContentAlignment="Center" />
                <Label Content="No File" MinHeight="24" Name="fileNameLabel" HorizontalContentAlignment="Center" />
            </StackPanel>

            <Button Content="Open File" MinHeight="24"  Name="openFileButton" Click="openFileButton_Click"  />
            <Button Content="Reset" MinHeight="24"  Name="resetButton"  Click="resetButton_Click" />
            <Label Content="Camera Postion" MinHeight="24" Name="cameraPosition" HorizontalContentAlignment="Center" />
            <StackPanel HorizontalAlignment="Center" Orientation="Horizontal">
                <StackPanel.ToolTip>Orthographic camera doesn't have persective - use Zoom</StackPanel.ToolTip>
                <TextBox Text="0" HorizontalAlignment="Left" Name="xCameraPosition" VerticalAlignment="Top" TextChanged="xCameraPosition_TextChanged"></TextBox>
                <TextBox Margin="5,0,0,0" Text="0" HorizontalAlignment="Left" Name="yCameraPosition" VerticalAlignment="Top" TextChanged="yCameraPosition_TextChanged"></TextBox>
            </StackPanel>
            <Label MinHeight="24" HorizontalContentAlignment="Center">Look Direction</Label>
            <StackPanel HorizontalAlignment="Center" Margin="0,0,0,0" Orientation="Horizontal">
                <StackPanel.ToolTip>Orthographic camera doesn't have persective - use Zoom</StackPanel.ToolTip>
                <TextBox Text="0" HorizontalAlignment="Left" Name="xLookDirection" VerticalAlignment="Top" TextChanged="xLookDirection_TextChanged"></TextBox>
                <TextBox Margin="5,0,0,0" Text="0" HorizontalAlignment="Left" Name="yLookDirection" VerticalAlignment="Top" TextChanged="yLookDirection_TextChanged"></TextBox>
                <!--<TextBox Margin="5,0,0,0" Text="40" HorizontalAlignment="Left" Name="zLookDirection" VerticalAlignment="Top" TextChanged="zLookDirection_TextChanged"></TextBox>-->
            </StackPanel>
            <StackPanel HorizontalAlignment="Center" Orientation="Vertical">
                <Label HorizontalContentAlignment="Center">Scale</Label>
                <TextBox Margin="0,0,0,5" Text="1" Foreground="White" HorizontalAlignment="Center" Name="scaleTextBox" VerticalAlignment="Top" TextChanged="scaleTextBox_TextChanged"></TextBox>
            </StackPanel>

            <Button Content="Save Image" MinHeight="24" Name="saveImageButton" Click="saveImageButton_Click"></Button>
            <ToggleButton Name="maskButton" Content="Mask"  MinHeight="24" Checked="maskButton_Checked" Unchecked="maskButton_Unchecked"></ToggleButton>
            <Button Content="Process Files" Height="24" Name="processFilesButton" Click="processFilesButton_Click" />
            <!--<Label Content="Mask" Height="25" HorizontalAlignment="Left" Margin="0,0,0,0" Name="maskLabel" VerticalAlignment="Top" Width="100" HorizontalContentAlignment="Center" />-->
            <!--<TextBox Text="14" Height="25" HorizontalAlignment="Left" Margin="0,0,0,0" Name="maskTextBox" VerticalAlignment="Top" Width="100" />-->
            <Label HorizontalContentAlignment="Center" MinHeight="24" Content="Change alpha"></Label>
            <Slider Name="alphaSlider" MinHeight="24" Minimum="0" Maximum="1.0" Value="1.0" ValueChanged="alphaSlider_ValueChanged"></Slider>

            <!--  <Button Content="Start animation" Height="25" Width="100" HorizontalAlignment="Left" Margin="0,5,0,0" Name="animationButton" VerticalAlignment="Bottom" Click="animationButton_Click" />-->
        </StackPanel>

        <StackPanel Visibility="Collapsed" Name="checkBoxPanel" HorizontalAlignment="Right" Width="50" CheckBox.Click="checkBoxPanel_Click" Opacity="0.0">
            <Label  Content="Mask" FontSize="12" FontWeight="Bold" Foreground="White" />
            <CheckBox Foreground="White" Content="1"></CheckBox>
            <CheckBox Foreground="White" Content="2"></CheckBox>
            <CheckBox Foreground="White" Content="3"></CheckBox>
            <CheckBox Foreground="White" Content="4"></CheckBox>
            <CheckBox Foreground="White" Content="5"></CheckBox>

            <CheckBox Foreground="White" Content="6"></CheckBox>
            <CheckBox Foreground="White" Content="7"></CheckBox>
            <CheckBox Foreground="White" Content="8"></CheckBox>
            <CheckBox Foreground="White" Content="9"></CheckBox>
            <CheckBox Foreground="White" Content="10"></CheckBox>

            <CheckBox Foreground="White" Content="11"></CheckBox>
            <CheckBox Foreground="White" Content="12"></CheckBox>
            <CheckBox Foreground="White" Content="13"></CheckBox>
            <CheckBox Foreground="White" Content="14" IsChecked="True"></CheckBox>
            <CheckBox Foreground="White" Content="15"></CheckBox>

            <CheckBox Foreground="White" Content="16"></CheckBox>
            <CheckBox Foreground="White" Content="17"></CheckBox>
            <CheckBox Foreground="White" Content="18"></CheckBox>
            <CheckBox Foreground="White" Content="19"></CheckBox>
            <CheckBox Foreground="White" Content="20"></CheckBox>

            <CheckBox Foreground="White" Content="21"></CheckBox>
            <CheckBox Foreground="White" Content="22"></CheckBox>
            <CheckBox Foreground="White" Content="23"></CheckBox>
        </StackPanel>
    </Grid>

</Window>